<template>
  <el-dialog v-dialogDrag
             :title="!this.dataForm.id ? '新增' : '详情'"
             :close-on-click-modal="false"
             :visible.sync="visible">
<!--    <el-form :model="dataForm" ref="dataForm"  label-position="left" inline class="demo-table-expand" label-width="140px">
      <el-form-item label="商品名称">
        <span>{{ dataForm.id }}</span>
      </el-form-item>
      <el-form-item label="地域编号">
        <span>{{ dataForm.azCode }}</span>
      </el-form-item>
      <el-form-item label="代理实例主机名">
        <span>{{ dataForm.agentHostname }}</span>
      </el-form-item>
      <el-form-item label="在线状态">
        <span>{{ dataForm.onlineStatusDesc }}</span>
      </el-form-item>
    </el-form>-->
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="" label-width="140px">
      <el-row>
        <el-col :span="12">
          <el-form-item label="主键" prop="id">
            <el-input v-model="dataForm.id" placeholder="主键" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="代理实例主机名" prop="agentHostname">
            <el-input v-model="dataForm.agentHostname" placeholder="代理实例主机名" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="在线状态" prop="onlineStatus">
            <el-input v-model="dataForm.onlineStatusDesc" placeholder="在线状态" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="代理实例IP" prop="agentIpv4">
            <el-input v-model="dataForm.agentIpv4" placeholder="代理实例IP" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="代理实例服务端口" prop="agentPort">
            <el-input v-model="dataForm.agentPort" placeholder="代理实例服务端口" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-form-item label="执行器描述" prop="agentDesc">
        <el-input v-model="dataForm.agentDesc" placeholder="" class="rdonly" :readonly="true"></el-input>
      </el-form-item>
      <el-row>
        <el-col :span="12">
          <el-form-item label="业务系统编号" prop="bizCode">
            <el-input v-model="dataForm.bizCode" placeholder="" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="版本号" prop="version">
            <el-input v-model="dataForm.version" placeholder="" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="创建时间" prop="createTime">
            <el-input v-model="dataForm.createTime" placeholder="" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="更新时间戳" prop="updateTime">
            <el-input v-model="dataForm.updateTime" placeholder="" class="rdonly" :readonly="true"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    data() {
      return {
        visible: false,
        dataForm: {
          id: '',
          azCode: '',
          agentHostname: '',
          agentIpv4: '',
          agentPort: '',
          onlineStatus: '',
          agentDesc: '',
          bizCode: '',
          createTime: '',
          version: '',
          updateTime: '',
        },
        dataRule: {
          id: [{required: false, message: '主键不能为空', trigger: 'blur'}],
          azCode: [{required: false, message: '地域编号不能为空', trigger: 'blur'}],
          agentHostname: [{required: false, message: '代理实例主机名不能为空', trigger: 'blur'}],
          agentIpv4: [{required: false, message: '代理实例IP不能为空', trigger: 'blur'}],
          agentPort: [{required: false, message: '代理实例服务端口不能为空', trigger: 'blur'}],
          onlineStatus: [{required: false, message: '在线状态不能为空', trigger: 'blur'}],
          agentDesc: [{required: false, message: '执行器描述不能为空', trigger: 'blur'}],
          bizCode: [{required: false, message: '业务系统编号不能为空', trigger: 'blur'}],
          createTime: [{required: false, message: '创建时间不能为空', trigger: 'blur'}],
          version: [{required: false, message: '版本号不能为空', trigger: 'blur'}],
          updateTime: [{required: false, message: '更新时间戳不能为空', trigger: 'blur'}],
        }
      }
    },
    methods: {
      init(id, row) {
        this.dataForm.id = id || ''
        this.visible = true
        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()
          if (this.dataForm.id ) {
            this.dataForm = row
          }
        })
      },
    }
  }
</script>
